package net.atomarrow.sy.util;

import net.atomarrow.db.orm.IDomainControl;
import net.atomarrow.domains.DomainUtil;

/**
 * Domain控制类
 * @author Michael
 *
 */
public class DomainControl implements IDomainControl{
	
	public static DomainControl INSTANCE=new DomainControl();

	/**
	 * 获得实体domain类名
	 * @param domain
	 * @return
	 */
	public String getDomainName(Class domain){
		String domainName = domain.getSimpleName();
		if(DomainUtil.isMultiTable(domainName)){
			return DomainUtil.getMultiTableName(domainName, 1);
		}
		return domainName;
	}
	
	/**
	 * 获得实体domain类名
	 * @param domain
	 * @return
	 */
	public String getDomainName(Class domain,Integer ssid){
		String domainName = domain.getSimpleName();
		if(DomainUtil.isMultiTable(domainName)){
			return DomainUtil.getMultiTableName(domainName, ssid);
		}
		return domainName;
	}
	
}
